package business_class;

import java.util.HashMap;

import com.ailk.cuc.autotestbg.common.utils.SpringContextUtil;
import com.ailk.cuc.autotestbg.xml.business.impl.ess.EssAssemblyComponentImpl;
import com.ailk.cuc.autotestbg.xml.business.impl.ess.EssReplaceComponentImpl;
import com.ailk.cuc.autotestbg.xml.business.impl.ess.EssSendOutComponentImpl;
import com.ailk.cuc.autotestbg.xml.exception.EssAssemblyException;
import com.ailk.cuc.autotestbg.xml.exception.EssReplaceException;
import com.ailk.cuc.autotestbg.xml.exception.EssSendOutException;

public class CheckPreSubmit {

	public String testCheckPreSubmit(HashMap<String,Object> argMapIn,HashMap<String,Object> argMapOut){
		
		String result = "0000";
		EssAssemblyComponentImpl assemblyComponent;
		EssReplaceComponentImpl replaceComponent;
		EssSendOutComponentImpl sendOutComponent;
		try {
			assemblyComponent = (EssAssemblyComponentImpl)SpringContextUtil.getBean("essAssemblyComponent");
			assemblyComponent.assemblyInfo(argMapIn,argMapOut);
			
			replaceComponent = (EssReplaceComponentImpl)SpringContextUtil.getBean("essReplaceComponent");
			replaceComponent.replaceInfo(argMapIn,argMapOut);
			
			sendOutComponent = (EssSendOutComponentImpl)SpringContextUtil.getBean("essSendOutComponent");
			sendOutComponent.sendOutInfo(argMapIn,argMapOut);
		} catch (EssAssemblyException e1) {
			e1.printStackTrace();
			result = "0001";
		} catch (EssReplaceException e1) {
			e1.printStackTrace();
			result = "0002";
		} catch (EssSendOutException e1) {
			e1.printStackTrace();
			result = "0003";
		} 
		
		return result;
	}
}
